Experimental Feature: Area Lights#236
Merged
Cameron-Micka merged 49 commits intomicrosoft:mainfrom Mar 26, 2025
Merged
Conversation
…hicsTools-Unity into user/cameron-micka/area-lights
There was a problem hiding this comment.
Pull Request Overview
Experimental Area Lights feature introduced to enable area light rendering with associated cookie filtering and editor visualization improvements. Key changes include:
- A new AreaLightInspector for visualizing and interacting with area lights in the editor.
- An AreaLightCookieFilter component that applies dual blurring to area light cookie textures.
- Added OnDrawGizmos implementations for various light types and extended AcrylicLayer with an ApplyDualBlur method.
Reviewed Changes
Copilot reviewed 42 out of 56 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| com.microsoft.mrtk.graphicstools.unity/Editor/Experimental/AreaLight/AreaLightInspector.cs | New inspector for experimental area light with scene visualization. |
| com.microsoft.mrtk.graphicstools.unity/Runtime/Experimental/AreaLight/AreaLightCookieFilter.cs | New component to filter cookie textures using dual blurring. |
| com.microsoft.mrtk.graphicstools.unity/Runtime/Lighting/ProximityLight.cs | Added editor gizmo drawing for proximity lights. |
| com.microsoft.mrtk.graphicstools.unity/Runtime/Lighting/DistantLight.cs | Added editor gizmo drawing for distant (directional) lights. |
| com.microsoft.mrtk.graphicstools.unity/Runtime/Lighting/HoverLight.cs | Added editor gizmo drawing for hover lights. |
| com.microsoft.mrtk.graphicstools.unity/Runtime/Experimental/Acrylic/Scripts/AcrylicLayer.cs | Extended with a new ApplyDualBlur method for dual blur functionality. |
Files not reviewed (14)
- com.microsoft.mrtk.graphicstools.unity/Editor/Experimental/AreaLight.meta: Language not supported
- com.microsoft.mrtk.graphicstools.unity/Editor/Experimental/AreaLight/AreaLightInspector.cs.meta: Language not supported
- com.microsoft.mrtk.graphicstools.unity/Runtime/Experimental/AreaLight.meta: Language not supported
- com.microsoft.mrtk.graphicstools.unity/Runtime/Experimental/AreaLight/AreaLight.cs.meta: Language not supported
- com.microsoft.mrtk.graphicstools.unity/Runtime/Experimental/AreaLight/AreaLightCookieFilter.cs.meta: Language not supported
- com.microsoft.mrtk.graphicstools.unity/Runtime/Experimental/AreaLight/AreaLightLUTDisneyDiffuse.cs.meta: Language not supported
- com.microsoft.mrtk.graphicstools.unity/Runtime/Experimental/AreaLight/AreaLightLUTGGX.cs.meta: Language not supported
- com.microsoft.mrtk.graphicstools.unity/Runtime/Experimental/AreaLight/Shaders.meta: Language not supported
- com.microsoft.mrtk.graphicstools.unity/Runtime/Experimental/AreaLight/Shaders/AreaLight.hlsl: Language not supported
- com.microsoft.mrtk.graphicstools.unity/Runtime/Experimental/AreaLight/Shaders/AreaLight.hlsl.meta: Language not supported
- com.microsoft.mrtk.graphicstools.unity/Runtime/Experimental/AreaLight/Shaders/AreaLightSubGraph.shadersubgraph.meta: Language not supported
- com.microsoft.mrtk.graphicstools.unity/Runtime/Experimental/AreaLight/Shaders/AreaLightVisualize.shader: Language not supported
- com.microsoft.mrtk.graphicstools.unity/Runtime/Experimental/AreaLight/Shaders/AreaLightVisualize.shader.meta: Language not supported
- com.microsoft.mrtk.graphicstools.unity/Samples~/AreaLight.meta: Language not supported
Comments suppressed due to low confidence (2)
com.microsoft.mrtk.graphicstools.unity/Runtime/Experimental/AreaLight/AreaLightCookieFilter.cs:121
- Consider checking that 'cookie' is assigned before accessing its width to avoid potential runtime errors.
int width = cookie.width;
com.microsoft.mrtk.graphicstools.unity/Runtime/Experimental/AreaLight/AreaLightCookieFilter.cs:209
- [nitpick] Consider using named arguments or adding inline comments for the constructor parameters to improve clarity and readability.
layer = new(null, null, 0, 0, true, null, cookieFilterMaterial);
vmoras6699
reviewed
Mar 26, 2025
vmoras6699
approved these changes
Mar 26, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This change introduces a new experimental light type called an
AreaLight- area lights allow light to emit from a polygonal surface (quad) rather than a single point. The technique is based off Unity's Adam Demo solution which is based off of this research.This solution works with the built in or URP's forward renderer. Only two area lights can be rendered at a time, but more than two lights can be added to a scene and the system will automatically cull the least important lights. Area lights are preview-able at edit time just like normal Unity lights.
The
AreaLightCookieFilteris a utility component to help "blur" the cookie for an area light. This is helpful for scenarios where the area light's cookie isn't pre-filtered (like a video texture). TheAreaLightCookieFilteronly works at runtime.This change also includes a new sample to preview how



AreaLights look and behave.Tested in editor, and Windows, WebGL, and Android (Quest 2) player builds.

Note,
AreaLights do not currently work with theGraphics Tools/StandardandGraphics Tools/Standard Canvasshaders while performance is evaluated. Examples of how to useAreaLight`s with handwritten shaders and shader graph shaders are included in the sample scene.Verification